package com.yaorange.web.controller.nongjt;

import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.yaorange.common.annotation.Log;
import com.yaorange.common.core.controller.BaseController;
import com.yaorange.common.core.domain.AjaxResult;
import com.yaorange.common.enums.BusinessType;
import com.yaorange.nongjt.domain.NjtDeviceCertificationInfo;
import com.yaorange.nongjt.service.INjtDeviceCertificationInfoService;
import com.yaorange.common.utils.poi.ExcelUtil;
import com.yaorange.common.core.page.TableDataInfo;

/**
 * 打印机认证情况Controller
 * 
 * @author hzliu
 * @date 2025-09-27
 */
@RestController
@RequestMapping("/nongjt/infot")
public class NjtDeviceCertificationInfoController extends BaseController
{
    @Autowired
    private INjtDeviceCertificationInfoService njtDeviceCertificationInfoService;

    /**
     * 查询打印机认证情况列表
     */
    @PreAuthorize("@ss.hasPermi('nongjt:infot:list')")
    @GetMapping("/list")
    public TableDataInfo list(NjtDeviceCertificationInfo njtDeviceCertificationInfo)
    {
        startPage();
        List<NjtDeviceCertificationInfo> list = njtDeviceCertificationInfoService.selectNjtDeviceCertificationInfoList(njtDeviceCertificationInfo);
        return getDataTable(list);
    }

    /**
     * 导出打印机认证情况列表
     */
    @PreAuthorize("@ss.hasPermi('nongjt:infot:export')")
    @Log(title = "打印机认证情况", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, NjtDeviceCertificationInfo njtDeviceCertificationInfo)
    {
        List<NjtDeviceCertificationInfo> list = njtDeviceCertificationInfoService.selectNjtDeviceCertificationInfoList(njtDeviceCertificationInfo);
        ExcelUtil<NjtDeviceCertificationInfo> util = new ExcelUtil<NjtDeviceCertificationInfo>(NjtDeviceCertificationInfo.class);
        util.exportExcel(response, list, "打印机认证情况数据");
    }

    /**
     * 获取打印机认证情况详细信息
     */
    @PreAuthorize("@ss.hasPermi('nongjt:infot:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(njtDeviceCertificationInfoService.selectNjtDeviceCertificationInfoById(id));
    }

    /**
     * 新增打印机认证情况
     */
    @PreAuthorize("@ss.hasPermi('nongjt:infot:add')")
    @Log(title = "打印机认证情况", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody NjtDeviceCertificationInfo njtDeviceCertificationInfo)
    {
        return toAjax(njtDeviceCertificationInfoService.insertNjtDeviceCertificationInfo(njtDeviceCertificationInfo));
    }

    /**
     * 修改打印机认证情况
     */
    @PreAuthorize("@ss.hasPermi('nongjt:infot:edit')")
    @Log(title = "打印机认证情况", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody NjtDeviceCertificationInfo njtDeviceCertificationInfo)
    {
        return toAjax(njtDeviceCertificationInfoService.updateNjtDeviceCertificationInfo(njtDeviceCertificationInfo));
    }

    /**
     * 删除打印机认证情况
     */
    @PreAuthorize("@ss.hasPermi('nongjt:infot:remove')")
    @Log(title = "打印机认证情况", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(njtDeviceCertificationInfoService.deleteNjtDeviceCertificationInfoByIds(ids));
    }
}
